#ifndef LOCATION_H
#define LOCATION_H

#include <QObject>
#include <QScriptValue>
#include <QDateTime>
#include <QGeoPositionInfoSource>
#include <QGeoPositionInfo>

class QScriptContext;

QScriptValue locationConstructor(QScriptContext *context, QScriptEngine *engine);
//QTM_USE_NAMESPACE

class Location : public QObject
{
    Q_OBJECT
public:
    explicit Location(int method = 2);
    typedef QtMobility::QGeoPositionInfo QGeoPositionInfo;

public slots:
    void startUpdates();
    void stopUpdates();

private slots:
    void positionUpdated(const QGeoPositionInfo &info);

signals:
    void locationUpdated(const QString& longitude, const QString& latitude, QDateTime dateTime);

private:
    QtMobility::QGeoPositionInfoSource *m_source;
    double m_prevLatitude;
    double m_prevLongitude;
    
};

#endif // LOCATION_H
